package grpc

import (
	"micro-svr/apps/s1/api"

	"go-main/library/conf"
	"go-main/library/net/rpc/warden"
)

// New a grpc server.
func New(svc api.DemoServer) (svr *warden.Server, err error) {
	var cfg warden.ServerConfig
	if err = conf.Bind("grpc", &cfg); err != nil {
		return
	}
	svr = warden.NewServer(&cfg, warden.WithAppId(api.AppID))
	api.RegisterDemoServer(svr.Server(), svc)
	svr, err = svr.Start()
	return
}
